<template>
  <div>
    <p>{{str}}</p>
    <input type="text" v-model="msg" @keyup.enter="fn"><button ref="nameBtn" @click="addfn">点击</button>
  </div>
</template>

<script>
export default {
  data(){
    return{
      str:'',
      msg:''
    }
  },
  methods:{
    addfn(){
      this.str = this.msg
    },
    fn(){
      this.$refs.nameBtn.click()
    }
  }
}
</script>

<style>

</style>
